<template>
  <div>
    <ul>
      <li v-for="(obj,index) in arr" :key="index">

        <span>{{obj}}</span>
      <button @click="delFn(index)">删除</button>
      </li>
    </ul>
    <button @click="addFn">生成</button>
  </div>
</template>

<script>
export default {
data () {
  return {
    arr:[1,5,3]
  }
},
methods: {
  addFn(){
    this.arr.push(Math.floor(Math.random()*10))
  },
  delFn(id){
    this.arr.splice(id,1)
  }
}
}
</script>

<style>

</style>